#!usr/bin/env node

const http = require('http');
http.createServer((req,res)=>{
  let html = '<html><body><h1>hello 旺仔</h1></body></html>'

  if(req.url == '/'){
    res.writeHead(200,{
      'Content-Type':'text/html',
      'Content-Length':Buffer.byteLength(html)
    });
    res.end(html);
    
  }else{
    res.statusCode = 404;
    res.setHeader('Content-Type','text/palin');
    res.end('Resource not found');
  }
}).listen(8080)
